/**
 * Copyright (C), 2001-2031, www.bosssof.com.cn
 * FileName: CourseSelect.java
 * Author: shixianwei
 * Date: 2024/8/15 9:49
 * Description:
 * <p>
 * History:
 * Date          Author   Version  Desc
 * 2024-01-01    bosssoft  1.0.0   initialize this file
 */
package com.bosssoft.setp.model.business.power;

import com.bosssoft.setp.model.business.course.Course;
import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.Tree;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.ReferenceTreeType;
import xyz.erupt.jpa.model.BaseModel;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @className: CourseSelect
 * @description:
 * 用于加盟商选择课程的中间表
 * @author: shixianwei
 * @date: 2024/8/15 9:49
 * @since 1.0
 **/
@Entity
@Table( name = "setp_course_select")
@Erupt( name = "课程选择",
        tree = @Tree(id = "id", label = "name", pid = "parent.id")
)
@Getter
@Setter

public class CourseSelect extends BaseModel {


    @EruptField(
            views = @View(title = "名称"),
            edit = @Edit(title = "名称")
    )
    private String name;

    @EruptField(
            views = @View(title = "是否是课程"),
            edit = @Edit(title = "是否是课程")
    )
    private Boolean isCourse;

    @ManyToOne
    @EruptField(
            edit = @Edit(
                    title = "上级课程",
                    type = EditType.REFERENCE_TREE,
                    referenceTreeType = @ReferenceTreeType(pid = "parent.id")
            )
    )
    private CourseSelect parent;

    @EruptField(
            views = @View(title = "课程ID"),
            edit = @Edit(title = "课程ID")
    )
    private Long courseId;

    @EruptField(
            views = @View(title = "课程类型ID"),
            edit = @Edit(title = "课程类型ID")
    )
    private Long courseTypeId;

}

